/**
 * 
 */
package me.dbest.javase.learn.bitManipultaion;

/**
 * @author nishant.awasthi
 *
 */
public class BitBasics {

	/**
	 * 
	 */
	public BitBasics() {
		
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		/*int testHex=0x2D;
		System.out.println(testHex);*/
		int test=60;
		//testBitNot(test);
		testBitShiftRight();
	}

	private static void testBitNot(int test) {
		System.out.println(Integer.toBinaryString(test));
		int x=~test;
		System.out.println(x);
		
		
	}
	private static void testBitShiftleft(int test) {
		System.out.println(Integer.toBinaryString(test));
		int x=test<<2;
		System.out.println(x);
		System.out.println(Integer.toBinaryString(x));
		
	}
	private static void testBitShiftRight() {
		int x=-61;
		System.out.println(x);
		System.out.println(x>>1);
		System.out.println(x>>>1);
		
		System.out.println(Integer.toBinaryString(x));
		
		//depends on sign extension
		System.out.println(Integer.toBinaryString(x>>1));
		//shifts a zero into the leftmost position
		System.out.println(Integer.toBinaryString(x>>>1));
		
	}
	
}
